﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace VehicleManagement.Models
{

    //----------------管理员表------------
    //CREATE	TABLE AdminInfo
    //(
    //AdminID int  IDENTITY(1,1) primary key,
    //Admin_name varchar(18)  not null ,
    //Admin_password varchar(18) not null,
    //Passw_ques varchar(30),
    //Passw_answer varchar(30),
    //Admin_image varchar(100),
    //Email varchar(30),
    //Sex  char(2),
    //Telephone varchar(18),
    //Remark varchar(100)
    //)

    /// <summary>
    /// 管理员信息类
    /// </summary>
    public class AdminInfo
    {
        public int AdminID { get; set; }

        [DisplayName("用户名")]
        [Required(ErrorMessage = "用户名不能为空")]
        [StringLength(18, ErrorMessage = "用户名长度不能超过18位")]
        //[Remote("GetAdminInfo", "AdminInfo", ErrorMessage = "该用户名已经存在")]
        public string AdminName { get; set; }

        [DisplayName("密码")]
        [DataType(DataType.Password)]
        [Required(ErrorMessage = "密码不能为空")]
        [StringLength(18, ErrorMessage = "密码长度不能超过18位")]
        public string AdminPassword { get; set; }

        [DisplayName("密码问题")]
        [StringLength(30, ErrorMessage = "密码问题长度不能超过30位")]
        public string PasswordQuestion { get; set; }

        [DisplayName("密码答案")]
        [StringLength(30, ErrorMessage = "密码答案长度不能超过30位")]
        public string PasswordAnswer { get; set; }

        [DisplayName("邮箱")]
        [Required(ErrorMessage = "邮箱不能为空")]
        [StringLength(30, ErrorMessage = "邮箱长度不能超过30位")]
        [RegularExpression(@"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$", ErrorMessage = "请输入正确的Email格式\n示例：abc@123.com")]
        public string Email { get; set; }

        [DisplayName("照片")]
        public string Image { get; set; }

        [DisplayName("性别")]
        public string Sex { get; set; }

        [DisplayName("电话")]
        [StringLength(18, ErrorMessage = "电话长度不能超过18位")]
        [RegularExpression(@"^(13[0-9]{9}|[0-9]{7,8}|0[0-9]{2,3}\-[0-9]{7,8}(\-[0-9]{0-4})?)$", ErrorMessage = "请输入正确的电话号码")]
        public string Telephone { get; set; }

        [DisplayName("备注")]
        [StringLength(100, ErrorMessage = "备注长度不能超过100位")]
        public string Remark { get; set; }

    }
}